<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>页面修改</title>
<link rel="stylesheet" href="css/bootstrap.min.css" />
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<script type="text/javascript">
	var xmlHttp = null;
	function checkOptionName(obj) {
		var loginName = obj.value;
		console.log(loginName);
		if (loginName.length == 0) { //如果用户名为空 则 不发送请求
			return;
		}
		// 选择器                     实际的 url  和 参数 		
		$("#msg").load("patientAjax?bid=" + loginName,function(result){ 
			console.log(result+",,,");
			document.getElementById("msg").innerHTML = result;
		});
	}
</script>
<style type="text/css">
	#msg{
		color:red;
	}
</style>
</head>
<body>

	<div id="drugAlter">
		<h4>修改信息  页面</h4>
		<form class="form-horizontal" action="updatePatient2.do" method="post">
			<div class="form-group">
				<label for="sname" class="col-sm-2 control-label">姓名</label>
				<div class="col-sm-10">
				<!-- 病人ID  挂号ID-->
					<input type="hidden" name = "suffer.sid" value="${patient.suffer.sid }">
					<input type="hidden" name = "pid" value="${patient.pid }">
					<input type="textarea" class="form-control" name="suffer.sname" disabled="disabled" value="${patient.suffer.sname }"
						id="sname" placeholder="清输入姓名">
				</div>
			</div>
			<div class="form-group">
				<label for="sphone" class="col-sm-2 control-label">手机号</label>
				<div class="col-sm-10">
					<input type="test" class="form-control" name="suffer.sphone" id="sphone" disabled="disabled" value="${patient.suffer.sphone }"
						placeholder="清输入手机号">
				</div>
			</div>
			<div class="form-group">
				<label for="saddre" class="col-sm-2 control-label">住址</label>
				<div class="col-sm-10">
					<input type="test" class="form-control" name="suffer.saddre" id="saddre" disabled="disabled" value="${patient.suffer.saddre }"
						placeholder="清输入病症">
				</div>
			</div>
			<div class="form-group">
				<label for="ptext" class="col-sm-2 control-label">病症</label>
				<div class="col-sm-10">
					<input type="test" class="form-control" name="ptext" id="ptext" value="${patient.ptext }"
						placeholder="清输入病症">
				</div>
			</div>
			<div class="form-group">
				<label for="ptime" class="col-sm-2 control-label">入住时间</label>
				<div class="col-sm-10">
					<input type="test" class="form-control" name="ptime" id="ptime" value="${patient.ptime }"
						placeholder="清输入病症">
				</div>
			</div>
			<div class="form-group">
				<label for="petYiMiao" class="col-sm-2 control-label">床位</label>
				<div class="col-sm-10" id="petYiMiao">
					<c:if test="${patient.bed.bid == 1 }"></c:if>
					<select name="bed.bid"  class="form-control" onchange="checkOptionName(this);">
						<option  value="-1">请选择</option>
						<option <c:if test="${patient.bed.bid == 1 }">selected="selected"</c:if> value="1">001</option>
						<option <c:if test="${patient.bed.bid == 2 }">selected="selected"</c:if> value="2">002</option>
						<option <c:if test="${patient.bed.bid == 3 }">selected="selected"</c:if> value="3">003</option>
						<option <c:if test="${patient.bed.bid == 4 }">selected="selected"</c:if> value="4">004</option>
						<option <c:if test="${patient.bed.bid == 5 }">selected="selected"</c:if> value="5">005</option>
						<option <c:if test="${patient.bed.bid == 6 }">selected="selected"</c:if> value="6">006</option>
						<option <c:if test="${patient.bed.bid == 7 }">selected="selected"</c:if> value="7">007</option>
						<option <c:if test="${patient.bed.bid == 8 }">selected="selected"</c:if> value="8">008</option>
						<option <c:if test="${patient.bed.bid == 9 }">selected="selected"</c:if> value="9">009</option>
						<option <c:if test="${patient.bed.bid == 10 }">selected="selected"</c:if> value="10">010</option>
						<option <c:if test="${patient.bed.bid == 11 }">selected="selected"</c:if> value="11">011</option>
						
						
					</select>
					<span id = "msg"></span>
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-info">修改</button>
				</div>
			</div>
		</form>
	</div>
</body>
</html>